home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tpgrwndw.zip / WINDOWS.PAS < prev    next >
Pascal/Delphi Source File  |  1993-01-04  |  7KB  |  131 lines

  1. (*  A graphics Window unit designed for the Adventure System *)
  2. Unit Windows;
  3. (******************************)
  4. (* Todd Fiala                 *)
  5. (* Graphics Window System     *)
  6. (* 11/28/89                   *)
  7. (******************************)
  8.  
  9. (***********)
  10.   Interface
  11. (***********)
  12. var
  13.    ShowBor,             (* True: Draws a border around window *)
  14.    HitKey  : boolean;   (* True: Window will only stay open till key hit *)
  15.    TextCol,             (* Text Color for Window *)
  16.    BorCol,              (* Border Color for Window *)
  17.    BackCol : word;      (* Background Color for Window *)
  18.  
  19. (****************************)
  20. (* Procedures and Functions *)
  21. (****************************)
  22.  
  23. (*************************************)
  24. (*      Procedure ClearText          *)
  25. (* Purpose : Clears the Text Buffer. *)
  26. (*************************************)
  27. Procedure ClearText;
  28.  
  29. (*************************************************)
  30. (*         Procedure BufEmpty                    *)
  31. (* Purpose  : Checks if the Text Buffer is empty *)
  32. (* Returns  : True if the buffer isn't empty     *)
  33. (*************************************************)
  34. Function BufEmpty : boolean;
  35.  
  36. (********************************************************************)
  37. (*                 Procedure WriteWndw                              *)
  38. (* Purpose : Adds text to the text buffer for the next window to be *)
  39. (*           opened.                                                *)
  40. (* Input   : AddString, the string to add to the buffer.            *)
  41. (********************************************************************)
  42. Procedure WriteWndw(AddString : string);
  43.  
  44. (********************************************************)
  45. (*              Procedure SetBuf                        *)
  46. (* Purpose : Set the buffer for reading from beginning. *)
  47. (********************************************************)
  48. Procedure SetBuf;
  49.  
  50. (******************************************************)
  51. (*             Function ReadBuf                       *)
  52. (* Purpose : Read the next character from the buffer. *)
  53. (* Returns : false if buffer has been read to end.    *)
  54. (* Out     : ch - the next character from the buffer. *)
  55. (******************************************************)
  56. Function ReadBuf(var ch : char) : boolean;
  57.  
  58. (*****************************************************************)
  59. (*                Procedure GraphWndw                            *)
  60. (* Purpose : Make a window on the screen, saving area behind it. *)
  61. (* Input   : Window (x1,y1) upper left, and (x2,y2) lower right  *)
  62. (* Output  : Window with border.                                 *)
  63. (*****************************************************************)
  64. Procedure GraphWndw(x1,y1,x2,y2 : word);
  65.  
  66. (*************************************************************************)
  67. (*                     Function GrPos                                    *)
  68. (* Purpose : converts graphics mode equate to the given text coordinate. *)
  69. (* Return  : graphics position.                                          *)
  70. (* Input   : TextPos, the text mode coordinate.                          *)
  71. (*************************************************************************)
  72. Function GrPos(TextPos : word) : word;
  73.  
  74. (***************************************************************)
  75. (*                  Procedure FormatBuf                        *)
  76. (* Purpose : Format the text buffer to the size of the window  *)
  77. (* Input   : WndwLen, the length of the window to format for   *)
  78. (***************************************************************)
  79. Procedure FormatBuf(WndwLen : byte);
  80.  
  81. (*******************************************************************)
  82. (*            Procedure WriteText                                  *)
  83. (* Purpose : Print the text from the buffer in a window.           *)
  84. (* Input   : x1,x2 for borders, y for starting y position.         *)
  85. (* Output  : Text printed from Text Buffer from x1 to x2, starting *)
  86. (*           at y.  Make sure your window is long(y) enough!       *)
  87. (*******************************************************************)
  88. Procedure WriteText(x1,y,x2 : word);
  89.  
  90. (*************************************************************************)
  91. (*                    Procedure CloseWndw                                *)
  92. (* Purpose : Will close the last open window.                            *)
  93. (* Output  : Will set WindowError to 1 if no open windows when executed. *)
  94. (*************************************************************************)
  95. Procedure CloseWndw;
  96.  
  97. (***************************************************************************)
  98. (*             Procedure OpenWndw                                          *)
  99. (* Purpose : Adds text to buffer and opens up a window at the coords.      *)
  100. (*           given.                                                        *)
  101. (* Input   : Window's (x1,y1) for upper left, (x2,y2) for lower right hand *)
  102. (*           coordinates of the window.                                    *)
  103. (* Output  : Window with all current text data.                            *)
  104. (***************************************************************************)
  105. Procedure OpenWndw(AddString : string;x1,y1,x2,y2 : word);
  106.  
  107. (********************************************************************)
  108. (*                  Function CursorWndw                             *)
  109. (* Purpose : Adds text to text buffer, opens up a window with text, *)
  110. (*           and reads in a line of text.                           *)
  111. (* Returns : String containing what was typed.                      *)
  112. (* Input   : AddString is any text to add to the buffer.  Will      *)
  113. (*           read input from keyboard.                              *)
  114. (* Output  : Window with space for typing.                          *)
  115. (********************************************************************)
  116. Function CursorWndw(AddString : string) : string;
  117.  
  118. (*****************************************************************)
  119. (* Procedure ShowWndw;                                           *)
  120. (* Purpose : Centers a window on screen and writes out formatted *)
  121. (*           text.                                               *)
  122. (* Input   : Text, to add to the text buffer                     *)
  123. (*****************************************************************)
  124. Procedure ShowWndw(text : string);
  125.  
  126. (********************************************************************)
  127. (*               Procedure ClearAllWndws                            *)
  128. (* Purpose : Will close all open windows and clear the text buffer. *)
  129. (* Output  : All open windows will be removed from the screen.      *)
  130. (********************************************************************)
  131. Procedure ClearAllWndws;